import requests
from config import url, headers_web,headers_wechat

class StudentParticipationRate:
    def __init__(self):
        self.url = url
        self.headers = headers_web

    @classmethod
    def get_student_partici_pation_all_rate(cls,url_path:str,params=None,headers=headers_web):
        """
        @Summary:接口-学生个人平均活跃度、班级平均活跃度统计
        @Description:云课堂学生端学生参与度使用
        :param url_path:/teachingApi/api/v1/studentparticipationrate/activityrate/statistics
        :param params:query:{
                            'classId':'',#班级id
                            'studentId':'',#学生id
                            'validCode':''#验证码&signKey=123123(md5加密)
                            }
        :param headers:
        :return:{
                'classActivityRate':'', #班级平均活跃度
                'groupJoinRateTotalRanking':'',#班级活跃度总排名
                'studentActivityRate':'',#学生个人平均活跃度
                'studentGroupJoinRateRanking':'',#学生班级活跃度排名
                'studentRealTimeActivityRate':''#学生实时个人平均活跃度
                }
        """
        url_path = url_path + "/teachingApi/api/v1/studentparticipationrate/activityrate/statistics"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_student_partici_pation_attendance_rate(cls,url_path:str,params=None,headers=headers_web):
        """
        @Summary:接口-学生考勤签到参与度统计
        @Description:云课堂学生web、小程序端-获取学生参与度使用
        :param url_path:/teachingApi/api/v1/studentparticipationrate/attendanceactivity/statistics
        :param params:query:{
                            'classId':'',#班级id
                            'studentId':'',#学生id
                            'validCode':''#验证码&signKey=123123(md5加密)
                            }
        :param headers:
        :return:{
                'absenteeismClassTimes':[], #缺勤课次
                'attendanceTotal':'',#考勤总数
                'joinTotal':'',#参与总数
                'participationRate':''#签到率
                }
        """
        url_path = url_path + "/teachingApi/api/v1/studentparticipationrate/attendanceactivity/statistics"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_student_partici_pation_classtest_rate(cls,url_path:str,params=None,headers=headers_web):
        """
        @Summary:接口-学生课堂测验参与度统计
        @Description:云课堂学生端学生参与度使用
        :param url_path:/teachingApi/api/v1/studentparticipationrate/classtest/statistics
        :param params:query:{
                            'classId':'',#班级id
                            'studentId':'',#学生id
                            'validCode':''#验证码&signKey=123123(md5加密)
                            }
        :param headers:
        :return:{
                'paticipationCount':[], #参与次数
                'paticipationRate':'',#参与率
                'perfectCount':'',#满分次数
                'totalCount':''#总次数
                }
        """
        url_path = url_path + "/teachingApi/api/v1/studentparticipationrate/classtest/statistics"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_student_partici_pation_discussion_rate(cls,url_path:str,params=None,headers=headers_web):
        """
        @Summary:接口-学生分组讨论参与度统计
        @Description:云课堂学生端学生参与度使用
        :param url_path:/teachingApi/api/v1/studentparticipationrate/discussionactivity/statistics
        :param params:query:{
                            'classId':'',#班级id
                            'studentId':'',#学生id
                            'validCode':''#验证码&signKey=123123(md5加密)
                            }
        :param headers:
        :return:{
                'paticipationCount':[], #参与次数
                'paticipationRate':'',#参与率
                'perfectCount':'',#满分次数
                'totalCount':''#总次数
                }
        """
        url_path = url_path + "/teachingApi/api/v1/studentparticipationrate/discussionactivity/statistics"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_student_personal_rate(cls,url_path:str,params=None,headers=headers_wechat):
        """
        @Summary:接口-学生个人平均活跃度
        @Description:云课堂学生端学生参与度使用
        :param url_path:/teachingApi/api/v1/studentparticipationrate/getpersonalparticipationRate
        :param params:{
                            'classId':'',#班级id
                            'studentId':'',#学生id
                            'validCode':''#验证码&signKey=123123(md5加密)
                            }
        :param headers:
        :return:{
                'studentActivityRate':[], #学生个人平均活跃度
                'studentRealTimeActivityRate':''#学生实时个人平均活跃度
                }
        """
        url_path = url_path + "/teachingApi/api/v1/studentparticipationrate/getpersonalparticipationRate"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_student_partici_pation_homework_rate(cls,url_path:str,params=None,headers=headers_web):
        """
        @Summary:接口-学生课后作业参与度统计
        @Description:云课堂学生端学生参与度使用
        :param url_path:/teachingApi/api/v1/studentparticipationrate/homework/statistics
        :param params:{
                            'classId':'',#班级id
                            'studentId':'',#学生id
                            'validCode':''#验证码&signKey=123123(md5加密)
                            }
        :param headers:
        :return:object:[{
                        'activityId':'',#活动id
                        'hasFinish':''#是否完成（true-完成 false-未完成）
                        }]
        """
        url_path = url_path + "/teachingApi/api/v1/studentparticipationrate/homework/statistics"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_student_partici_pation_learningtest_rate(cls, url_path: str, params=None, headers=headers_web):
        """
        @Summary:接口-学生学情测验参与度统计
        @Description:云课堂学生端学生参与度使用
        :param url_path:/teachingApi/api/v1/studentparticipationrate/learningtest/statistics
        :param params:{
                            'classId':'',#班级id
                            'studentId':'',#学生id
                            'validCode':''#验证码&signKey=123123(md5加密)
                            }
        :param headers:
        :return:{
                'paticipationCount':'', #参与次数
                'paticipationRate':'',#参与率
                'totalCount':''#总次数
                }
        """
        url_path = url_path + "/teachingApi/api/v1/studentparticipationrate/learningtest/statistics"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_student_partici_pation_rate_for_type(cls, url_path: str, params=None, headers=headers_web,paramspath=None):
        """
        @Summary:接口-根据活动类型获取学生参与度统计信息
        @Description:云课堂学生端学生参与度使用
        :param url_path:/teachingApi/api/v1/studentparticipationrate/{type}/statistics
        :param params:{
                        'classId':'',#班级id
                        'studentId':'',#学生id
                        'validCode':''#验证码&signKey=123123(md5加密)
                        }
        :param headers:
        :param paramspath:type:活动类型（1-学习材料 2-课堂答题）
        :return:{
                'paticipationCount':'', #参与次数
                'paticipationRate':'',#参与率
                'totalCount':''#总次数
                }
        """

        url_path = url_path + "/teachingApi/api/v1/studentparticipationrate/{}/statistics".format(paramspath)
        r = requests.get(url=url_path, headers=headers, params=params)
        return r